##4.2 Cervejas
cervejas <-c("chope","lata","garrafa","chope","garrafa", "garrafa","lata","lata","nenhuma","lata","garrafa","garrafa", "garrafa","lata","lata","lata","garrafa","lata","chope","nenhuma", "garrafa","garrafa","garrafa","chope","garrafa","garrafa","chope","garrafa","lata","lata")
cervejas.table<-table(cervejas)
par(mfrow=c(2,1))
barplot(cervejas.table,xlab="Tipos",ylab="N de estudantes",horiz=F,space=0.5,axes=T)
dotchart(cervejas.table,xlab="N de estudantes")

##4.3 Caixetais
caixeta<-read.table("caixeta.csv",header=T,sep=",")
head(caixeta)
#Histograma DAP
par(mfrow=c(1,1))
hist(((caixeta$cap)/pi), xlab="DAP(cm)",main="")
#Histograma Altura
histogram(caixeta$h[caixeta$local=="chauas"],type="percent",col="grey")
histogram(caixeta$h[caixeta$local=="jureia"],type="percent",col="grey")
histogram(caixeta$h[caixeta$local=="retiro"],type="percent",col="grey")
#O local chauas se distingue de jureia e retiro. J entre os dois ultimos no h diferena.

##4.4 Eucaliptos
eucalipto<-read.table("egrandis.csv",header=T,sep=";")
par(mfrow=c(2,1))
boxplot(dap~regiao,data=eucalipto,col=rainbow(20))
boxplot(dap~rotacao,data=eucalipto,col=rainbow(20))
par(mfrow=c(1,1))
qqnorm(eucalipto$h)

##Mais Caixeta
caixeta<-read.table("caixeta.csv",header=T,sep=",")
caixeta$dap.h<-((caixeta$cap/pi)/caixeta$h)
par(mfrow=c(2,1))
plot(caixeta$dap.h[which(caixeta$especie=="Tabebuia cassinoides")]~caixeta$local[which(caixeta$especie=="Tabebuia cassinoides")],ylab="Relao DAP/Altura",xlab="Locais")
scatter.smooth(caixeta$dap.h[which(caixeta$especie=="Tabebuia cassinoides")]~caixeta$local[which(caixeta$especie=="Tabebuia cassinoides")],ylab="Relao DAP/Altura",xlab="Locais")
require(lattice)
barchart(caixeta$dap.h[which(caixeta$especie=="Tabebuia cassinoides")]~caixeta$local[which(caixeta$especie=="Tabebuia cassinoides")],ylab="Relao DAP/Altura",xlab="Locais")